package DaEr5_19;

import java.util.ArrayList;
import java.util.Iterator;

public class ArrayListStudy {
    public static void main(String[] args) {
        ArrayList date1 = new ArrayList();
        date1.add("早上好");
        date1.add("吃饭了吗");
        date1.add("666");
        date1.add("ok");
        //普通循环
        for (int i=0;i< date1.size();i++){
            System.out.println("date1.get() = " + date1.get(i));
        }
        //foreach
        for (Object a:date1){
            System.out.println("a = " + a);
        }
        date1.remove(2);
        //迭代器
        Iterator iterator = date1.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println("next = " + next);
        }
    }
}
